#include <stdint.h>
#include <nxos.h>

/* This assumes that a check for the
   template size has already been made */
char *__randname(char *template)
{
	int i;
    NX_TimeVal tv;
	unsigned long r;

    tv = NX_ClockGetMillisecond();

	r = ((tv*65537) ^ ((uintptr_t)&tv)) / 16 + (uintptr_t)template;

	for (i=0; i<6; i++, r>>=5)
		template[i] = 'A'+(r&15)+(r&16)*2;

	return template;
}
